<?php
namespace app\admin\validate;

class ApiResumeValidate extends CommonValidate
{
    /**
     * 验证规则
     * @var string[]
     */
    protected $rule = [
        'spot_uuid'         =>  'require',                    // 景区
        'project_uuid'      =>  'require',                    // 入团名称
        'supplier_uuid'     =>  'require',                      // 分销商
        'resume_name'       =>  'require',                      // 姓名
        'resume_sex'        =>  'require|in:男,女',              // 性别
        'resume_age'        =>  'require|number|between:1,99',  // 年龄
        'resume_mobile'     =>  'require|isMobile',             // 手机号
        'id_type'           =>  'require|number',               // 证件类型
        'resume_number'     =>  'require|regex:/^[^\x{4e00}-\x{9fa5}]+$/u', // 证件号码
        'resume_date'       =>  'require',                      // 游玩日期

    ];

    /**
     * 提示消息
     * @var string[]
     */
    protected $message = [
        'spot_uuid.require'     =>  '请选择景区',
        'project_uuid.require'  =>  '请选择入团名称',
        'supplier_uuid.require' =>  '请选择分销商',
        'resume_name.require'   =>  '请填写姓名',
        'resume_sex.require'    =>  '请选择性别',
        'resume_sex.in'         =>  '性别值不正确',
        'resume_age.require'    =>  '请填写年龄值',
        'resume_age.number'     =>  '年龄值必须为数值',
        'resume_age.between'    =>  '年级区间在1-99之间',
        'resume_mobile.require' =>  '请填写手机号',
        'resume_mobile.isMobile'=>  '手机号格式错误',
        'id_type.require'       =>  '请选择证件类型',
        'id_type.number'        =>  '证件类型必须为数值',
        'resume_number.require' =>  '请填写证件号',
        'resume_number.regex'   =>  '证件号不能包含中文',
        'resume_date.require'   =>  '请选择游玩日期',
    ];

    /**
     * 验证对象
     * @var array[]
     */
    protected $scene = [
        'add'  => ['spot_uuid','supplier_uuid','resume_name','resume_sex','resume_age','resume_mobile','id_type','resume_number','resume_date'],
        'adds'  => ['resume_mobile','supplier_uuid','spot_uuid','resume_date','project_uuid'],
        'edit' => ['spot_uuid','supplier_uuid','resume_name','resume_sex','resume_age','resume_mobile','id_type','resume_number','resume_date'],
    ];
}